﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using API.Interfaces;
using Framework.Business;
using Framework.Extensions;
using SignalPositionProcesser.Business;
using SignalPositionProcesser.Entities;

namespace SignalPositionProcesser.Service
{
    public class ImportChannelService : RestServiceBase<ImportChannelRequest>
    {
        public override object OnPost(ImportChannelRequest request)
        {
            var response = new ImportChannelResponse();
            try
            {
                var ctx = new ServiceContextBase<ImportChannelRequest, ImportChannelResponse>(request, response);
                ImportChannelBusiness.ImportChannelFromMysqlToNosql(ctx);

                ctx.Response.Succeeded = true;
            }
            catch (Exception e)
            {
                response.CaptureException(e);
            }

            return response;
        }
    }
}
